import { defineComponent } from 'vue'
import useAppStore from '@/store/app'
import Test from './views/Test'

export default defineComponent({
  name: 'App',
  setup() {
    const { SET_TOKEN, asyncSetToken } = useAppStore
    /* render 函数 */
    return () => {
      const { token, tokenWithPrefix } = useAppStore
      return (
        <div>
          <h2>组件一</h2>
          <div>{token}</div>
          <div>{tokenWithPrefix}</div>
          <div>
            <button onClick={() => SET_TOKEN('456')}>同步</button>
          </div>
          <div>
            <button onClick={() => asyncSetToken('789')}>异步</button>
          </div>
          <hr />
          <Test />
        </div>
      )
    }
  }
})
